var express = require("express");
var router = express.Router();
const { verifyToken } = require("../middleware/jwt");
const { verifyRole } = require("../middleware/role");
const userContorller = require("../contorller/userContorller");
const userRules = require("../middleware/userValidate");
router
  .post("/create", userRules.createUserValidate, userContorller.createUser)
  .post("/login", userRules.userLogin, userContorller.userLogin)
  .get("/loginByoauth", userContorller.oauthLogin)
  .get("/callbackByGitee", userContorller.giteeCallback)
  //修改用户
  .patch(
    "/update",
    verifyToken(),
    verifyRole("user"),
    userContorller.updateUser
  )
  //删除用户
  .delete(
    "/delete",
    verifyToken(),
    verifyRole("user"),
    userContorller.deleteUser
  )
  //获取用户信息
  .get('/getUserInfo', verifyToken(), userContorller.getUserInfo)
module.exports = router;
